<?php

namespace Kunfeng\Dify\Event;

/**
 * 文件消息事件
 */
class MessageFileEvent extends BaseEvent
{
    private $fileId;
    private $fileName;
    private $fileType;
    private $url;

    public function __construct(
        string $event,
        array $data = []
    ) {
        parent::__construct($event, $data);
        
        $this->fileId = $data['file_id'] ?? '';
        $this->fileName = $data['file_name'] ?? '';
        $this->fileType = $data['file_type'] ?? '';
        $this->url = $data['url'] ?? '';
    }

    /**
     * 从数组创建事件
     */
    public static function fromArray(array $data)
    {
        return new self($data['event'] ?? 'message_file', $data);
    }

    public function getFileId(): string
    {
        return $this->fileId;
    }

    public function getFileName(): string
    {
        return $this->fileName;
    }

    public function getFileType(): string
    {
        return $this->fileType;
    }

    public function getUrl(): string
    {
        return $this->url;
    }
}
